.class Lcom/hyphenate/chat/EMSmartHeartBeat$5;
.super Ljava/lang/Object;

# interfaces
.implements Ljava/lang/Runnable;


# instance fields
.field final synthetic this$0:Lcom/hyphenate/chat/EMSmartHeartBeat;


# direct methods
.method constructor <init>(Lcom/hyphenate/chat/EMSmartHeartBeat;)V
    .locals 0

    iput-object p1, p0, Lcom/hyphenate/chat/EMSmartHeartBeat$5;->this$0:Lcom/hyphenate/chat/EMSmartHeartBeat;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


# virtual methods
.method public run()V
    .locals 3

    const-string/jumbo v0, "smart ping"

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string/jumbo v2, "has network connection:"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    iget-object v2, p0, Lcom/hyphenate/chat/EMSmartHeartBeat$5;->this$0:Lcom/hyphenate/chat/EMSmartHeartBeat;

    # getter for: Lcom/hyphenate/chat/EMSmartHeartBeat;->mContext:Landroid/content/Context;
    invoke-static {v2}, Lcom/hyphenate/chat/EMSmartHeartBeat;->access$000(Lcom/hyphenate/chat/EMSmartHeartBeat;)Landroid/content/Context;

    move-result-object v2

    invoke-static {v2}, Lcom/hyphenate/util/NetUtils;->hasNetwork(Landroid/content/Context;)Z

    move-result v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string/jumbo v2, " has data conn:"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    iget-object v2, p0, Lcom/hyphenate/chat/EMSmartHeartBeat$5;->this$0:Lcom/hyphenate/chat/EMSmartHeartBeat;

    # getter for: Lcom/hyphenate/chat/EMSmartHeartBeat;->mContext:Landroid/content/Context;
    invoke-static {v2}, Lcom/hyphenate/chat/EMSmartHeartBeat;->access$000(Lcom/hyphenate/chat/EMSmartHeartBeat;)Landroid/content/Context;

    move-result-object v2

    invoke-static {v2}, Lcom/hyphenate/util/NetUtils;->hasDataConnection(Landroid/content/Context;)Z

    move-result v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder;

    move-result-object v1

    const-string/jumbo v2, " isConnected to hyphenate server : "

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-static {}, Lcom/hyphenate/chat/EMClient;->getInstance()Lcom/hyphenate/chat/EMClient;

    move-result-object v2

    invoke-virtual {v2}, Lcom/hyphenate/chat/EMClient;->isConnected()Z

    move-result v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Lcom/hyphenate/util/EMLog;->d(Ljava/lang/String;Ljava/lang/String;)V

    iget-object v0, p0, Lcom/hyphenate/chat/EMSmartHeartBeat$5;->this$0:Lcom/hyphenate/chat/EMSmartHeartBeat;

    # invokes: Lcom/hyphenate/chat/EMSmartHeartBeat;->hasDataConnection()Z
    invoke-static {v0}, Lcom/hyphenate/chat/EMSmartHeartBeat;->access$1000(Lcom/hyphenate/chat/EMSmartHeartBeat;)Z

    move-result v0

    if-eqz v0, :cond_1

    iget-object v0, p0, Lcom/hyphenate/chat/EMSmartHeartBeat$5;->this$0:Lcom/hyphenate/chat/EMSmartHeartBeat;

    # getter for: Lcom/hyphenate/chat/EMSmartHeartBeat;->wakeLock:Landroid/os/PowerManager$WakeLock;
    invoke-static {v0}, Lcom/hyphenate/chat/EMSmartHeartBeat;->access$1100(Lcom/hyphenate/chat/EMSmartHeartBeat;)Landroid/os/PowerManager$WakeLock;

    move-result-object v0

    invoke-virtual {v0}, Landroid/os/PowerManager$WakeLock;->acquire()V

    const-string/jumbo v0, "smart ping"

    const-string/jumbo v1, "acquire wake lock"

    invoke-static {v0, v1}, Lcom/hyphenate/util/EMLog;->d(Ljava/lang/String;Ljava/lang/String;)V

    iget-object v0, p0, Lcom/hyphenate/chat/EMSmartHeartBeat$5;->this$0:Lcom/hyphenate/chat/EMSmartHeartBeat;

    # invokes: Lcom/hyphenate/chat/EMSmartHeartBeat;->checkPingPong()V
    invoke-static {v0}, Lcom/hyphenate/chat/EMSmartHeartBeat;->access$1200(Lcom/hyphenate/chat/EMSmartHeartBeat;)V

    iget-object v0, p0, Lcom/hyphenate/chat/EMSmartHeartBeat$5;->this$0:Lcom/hyphenate/chat/EMSmartHeartBeat;

    # invokes: Lcom/hyphenate/chat/EMSmartHeartBeat;->releaseWakelock()V
    invoke-static {v0}, Lcom/hyphenate/chat/EMSmartHeartBeat;->access$1300(Lcom/hyphenate/chat/EMSmartHeartBeat;)V

    :cond_0
    :goto_0
    invoke-static {}, Lcom/hyphenate/a/a;->d()V

    iget-object v0, p0, Lcom/hyphenate/chat/EMSmartHeartBeat$5;->this$0:Lcom/hyphenate/chat/EMSmartHeartBeat;

    invoke-virtual {v0}, Lcom/hyphenate/chat/EMSmartHeartBeat;->scheduleNextAlarm()V

    return-void

    :cond_1
    const-string/jumbo v0, "smart ping"

    const-string/jumbo v1, "....no connection to server"

    invoke-static {v0, v1}, Lcom/hyphenate/util/EMLog;->d(Ljava/lang/String;Ljava/lang/String;)V

    iget-object v0, p0, Lcom/hyphenate/chat/EMSmartHeartBeat$5;->this$0:Lcom/hyphenate/chat/EMSmartHeartBeat;

    # getter for: Lcom/hyphenate/chat/EMSmartHeartBeat;->mContext:Landroid/content/Context;
    invoke-static {v0}, Lcom/hyphenate/chat/EMSmartHeartBeat;->access$000(Lcom/hyphenate/chat/EMSmartHeartBeat;)Landroid/content/Context;

    move-result-object v0

    invoke-static {v0}, Lcom/hyphenate/util/NetUtils;->hasDataConnection(Landroid/content/Context;)Z

    move-result v0

    if-nez v0, :cond_0

    invoke-static {}, Lcom/hyphenate/chat/EMClient;->getInstance()Lcom/hyphenate/chat/EMClient;

    move-result-object v0

    invoke-virtual {v0}, Lcom/hyphenate/chat/EMClient;->isConnected()Z

    move-result v0

    if-eqz v0, :cond_0

    invoke-static {}, Lcom/hyphenate/util/Utils;->isSdk14()Z

    move-result v0

    if-eqz v0, :cond_2

    const-string/jumbo v0, "smart ping"

    const-string/jumbo v1, "no data connection but im connection is connected, reconnect"

    invoke-static {v0, v1}, Lcom/hyphenate/util/EMLog;->d(Ljava/lang/String;Ljava/lang/String;)V

    invoke-static {}, Lcom/hyphenate/chat/EMClient;->getInstance()Lcom/hyphenate/chat/EMClient;

    move-result-object v0

    sget-object v1, Lcom/hyphenate/chat/adapter/EMAChatClient$EMANetwork;->NETWORK_NONE:Lcom/hyphenate/chat/adapter/EMAChatClient$EMANetwork;

    invoke-virtual {v0, v1}, Lcom/hyphenate/chat/EMClient;->onNetworkChanged(Lcom/hyphenate/chat/adapter/EMAChatClient$EMANetwork;)V

    goto :goto_0

    :cond_2
    invoke-static {}, Lcom/hyphenate/chat/EMClient;->getInstance()Lcom/hyphenate/chat/EMClient;

    move-result-object v0

    invoke-virtual {v0}, Lcom/hyphenate/chat/EMClient;->forceReconnect()V

    goto :goto_0
.end method
